package model

import (
	"errors"
	"github.com/doujunyu/gogo/sql_aid"
)

const TableByUserAddress = "self_user_address"

const UserAddressByDefaultNo = "0" //显示
const UserAddressByDefaultYes = "1" //隐藏

func UserAddressByOnlyId(id int64) (map[string]interface{}, error) {
	dataSql, args := sql_aid.PgTable(TableByUserAddress).Where("id = ?", id).ToSql()
	data, err := sql_aid.DataToMap(PgSql.Query(dataSql, args...))
	if err != nil {
		return nil, err
	}
	if len(data) == 0 {
		return nil, errors.New("没有找到信息")
	}
	return data[0], nil
}
